<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>培训文件列表页面-个人端下载</title>
<%@ include file="/module/js.jsp"%>
<%@ include file="/module/orderField.jsp"%>
<script type="text/javascript" src="${basePath}/js/jquery.Huploadify.js"></script>
	<link href="${basePath}/css/Huploadify.css" rel="stylesheet">
	<style>
	table label.error {
		margin-left: 5px;
		width: auto;
		display: inline;
		color: red;
	}
	
	table tr td{color:black;}
	.textat {text-align: center;}
	</style>
</head>
<body>
	<form action="#" name="Form" id="Form" method="post">
		<input type="hidden" name="idList" id="idList" />
		<%@ include file="/module/orderField.jsp"%>
		<table cellpadding="1" cellspacing="1" border="0">
			<tr>
				<td><input type="button" id="btnQuery" value="查 询"
					class="inputButton" /></td>
			</tr>
		</table>
		<table cellpadding="1" cellspacing="1">
			<tr>
				<td>文件名：<input type="text" name="fileName"  id="fileName"  value="" 	class="inputText2" /></td>
				<td>关键字：<input type="text" name="keyWords"  id="keyWords"  value="" 	class="inputText2" /></td>
				<td>类别：<input type="text" name="fileType"  id="fileType"  value="" 	class="inputText2" /></td>
				<td>
                 上传日期：   从
                    <input name="startTime" id="startTime"  autocomplete="off"
                           class="Wdate required inputText2" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
                    到
                    <input name="endTime" id="endTime" autocomplete="off"
                           class="Wdate required inputText2" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
                </td>
			</tr>
		</table>
		<br />
		<table id="dg" style="width: 100%;"
			data-options="pagination:true,collapsible:true,url:'${basePath}/trainingDoc/list',method:'post',remoteSort:true">
			<thead>
				<tr>
					<th
						data-options="field:'fileId',checkbox:true,width:80,align:'center'"></th>
					<th
						data-options="field:'fileName',nowrap:true,width:200,align:'center',sortable:true,formatter:go2Info">文件名</th>
					<th
						data-options="field:'fileSize',nowrap:true,width:150,align:'center',sortable:true">文件大小</th>
					<th
						data-options="field:'fileType',nowrap:true,width:200,align:'center',sortable:true">类别</th>
					<th
						data-options="field:'creatorName',nowrap:true,width:200,align:'center',sortable:true">创建人</th>
					<th
						data-options="field:'createTime',nowrap:true,width:200,align:'center',sortable:true">创建时间</th>
				</tr>
			</thead>
		</table>
		
		<div id="div1" style="display: none;">
            <table cellpadding="0" style="padding-top: 20px;" cellspacing="0" border="0" class="table-border" width="100%">
                <tr>
					<td>关键字：<input type="text" name="keyWords1"  id="keyWords1"  value="" 	class="inputText2" /></td>
				 </tr>
				 <tr>
					<td>类别：<input type="text" name="fileType1"  id="fileType1"  value="" 	class="inputText2" /></td>
                </tr>
                <tr>
                	<td>文件：<div id="uploadadd"></div></td>
                </tr>
                <!-- <tr>
                	<td><input type="button" id="btnUploadOK" value="上传" class="inputButton" /></td>
                </tr> -->
            </table>
        </div>
	</form>
	<script type="text/javascript">
		$(document)
				.ready(
						function() {

							$('#dg')
									.datagrid(
											{
												rowStyler : function(index, row) {
												},
												onLoadSuccess : function(data) {//加载完毕后获取所有的checkbox遍历
													if (data.rows.length > 0) {
													}
												},
											});
							//查询
							$('#btnQuery').click(function() {
								$('#dg').datagrid('load', {
									fileName : $('#fileName').val(),
									keyWords : $("#keyWords").val(),
									fileType : $("#fileType").val(),
									startTime : $("#startTime").val(),
									endTime : $("#endTime").val()
									
								});
							});
							$('#easyui-ck').click(function() {
								var data = $("#dg").datagrid("getSelections");
								for (var i = 0; i < data.length; i++) {
								}
							});
							
 
							$('#btnDelete')
									.click(
											function() {
												$("#idList").val("");
												var count = 0;
												var idList = new Array();
												var sels = $("#dg").datagrid(
														"getSelections");
												for ( var i in sels) {
													idList.push(sels[i].fileId);
													count++;
												}

												if (count == 0) {
													layer.alert(
															"您至少选择一条删除记录信息", {
																icon : 3
															});
													return false;
												} else {
													layer
															.confirm(
																	"您是否删除当前选中数据信息",
																	{
																		icon : 3,
																		title : '提示',
																		skin : 'layer-ext-moon'
																	},
																	function(
																			index) {
																		$(
																				"#idList")
																				.val(
																						idList);
																		document.Form.action = "${basePath}/trainingDoc/delete";
																		document.Form
																				.submit();
																	},
																	function(
																			index) {
																		layer
																				.close(index);
																	});
												}
											});
						});
		if ("${msg}" != "") {
			layer.alert("${msg}", {
				icon : 6
			});
		}
		
		function go2Info(value,row, index) {
			
		       return "<a href='${basePath}/DownLoadFileServlet?filename="+row.fileName+"&filepath="+row.filePath+"'>" + value + "</a>";
		  }
	</script>
</body>
</html>
